Skip to content

feat: add rollback command for instantly rolling back to previous deployments#163

Merged
AryanBansal-launch merged 1 commit into
developmentfrom
CL-1753_a
May 18, 2026
Merged

feat: add rollback command for instantly rolling back to previous deployments#163
AryanBansal-launch merged 1 commit into
developmentfrom
CL-1753_a

Conversation

@AryanBansal-launch
Copy link
Copy Markdown
Contributor

No description provided.

@AryanBansal-launch AryanBansal-launch requested review from a team as code owners May 18, 2026 11:02
@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 4 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@AryanBansal-launch AryanBansal-launch merged commit 0e947c5 into development May 18, 2026
6 checks passed
@AryanBansal-launch AryanBansal-launch deleted the CL-1753_a branch May 18, 2026 11:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new launch:rollback command to enable “instant rollback” to a prior deployment, including interactive selection/review prompts and the supporting GraphQL operations + tests.

Changes:

  • Introduces a new rollback command (src/commands/launch/rollback.ts) that resolves org/project/environment, selects an eligible prior deployment, confirms, and triggers a rollback mutation.
  • Extends GraphQL queries/mutations to support rollback (adds rollbackDeploymentMutation, and conditionally fetches rollback-related deployment fields from environmentsQuery).
  • Adds unit tests for rollback behavior (Mocha/Sinon + Jest) and updates .talismanrc to ignore the new test fixtures.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/commands/launch/rollback.ts Implements the new rollback command flow and related UI prompts/output.
src/graphql/queries.ts Adds rollback-relevant fields to latestLiveDeploymentQuery and makes rollback fields in environmentsQuery conditionally selectable.
src/graphql/mutation.ts Adds and exports rollbackDeploymentMutation.
test/unit/commands/rollback.test.ts Adds Mocha/Sinon unit coverage for rollback CLI execution paths.
src/commands/launch/rollback.test.ts Adds Jest unit coverage for core rollback logic/error handling.
.talismanrc Ignores the newly added test files for secret scanning via checksum entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +53 to +76
async run(): Promise<void> {
if (!this.flags.environment) {
await this.getConfig();
}

if (!this.sharedConfig.currentConfig?.uid) {
await selectOrg({
log: this.log,
flags: this.flags,
config: this.sharedConfig,
managementSdk: this.managementSdk,
});
await this.prepareApiClients(); // NOTE update org-id in header
await selectProject({
log: this.log,
flags: this.flags,
config: this.sharedConfig,
apolloClient: this.apolloClient,
});
await this.prepareApiClients(); // NOTE update project-id in header
}

await this.rollbackDeployment();
}
Comment on lines +109 to +137
try {
await this.apolloClient.mutate({
mutation: rollbackDeploymentMutation,
variables: {
input: {
deployment: target.uid,
environment: environment.uid,
...(reason ? { reason } : {}),
},
},
});
} catch (error: unknown) {
const err = error as { graphQLErrors?: { extensions?: { exception?: { name?: string } } }[]; message?: string };
const code = err?.graphQLErrors?.[0]?.extensions?.exception?.name || err?.message;
this.log(`Rollback failed. Please try again. (${code})`, 'error');
process.exit(1);
}

ux.print('');
ux.print(
`Promoting deployment ${chalk.cyan(`#${target.deploymentNumber}`)} `
+ chalk.dim(`(${target.uid})`) + '…',
);

ux.print('');
ux.print(chalk.green('✔ Instant rollback to a previous deployment is successful.'));
const label = `${chalk.cyan(`#${target.deploymentNumber}`)} ${chalk.dim(`(${target.uid})`)}`;
ux.print(` Deployment ${label} is now ${chalk.green('LIVE')}.`);
ux.print('');
}) as any);
});

afterEach(() => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants